<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends CommonController{
    public function index(){
        //获取新订单
        $today_order=$this->getToDayOrd();
        $this->assign('today',$today_order);
        $this->display();
    }

    public function getToDayOrd(){
        $startTime = strtotime(date('Ymd'));
        $endTime=strtotime(date('Ymd')) + 86400;
        $umc=D('orders_list')->where(array('ac_time'=>array('BETWEEN',array($startTime,$endTime))))->select();
        $co=D('orders_list')->where(array('ac_time'=>array('BETWEEN',array($startTime,$endTime),'status'=>'1')))->select();
        if($umc){
            $res['order_num']=count($umc);
            $res['order_price_count']=array_sum(array_column($umc,'price'));
            $res['cont']=count($co);
        }else{
            $res['order_num']='暂无';
            $res['order_price_count']='暂无';
            $res['cont']='暂无';
        }
        return $res;
    }
}